package com.jia.leetCode;

import java.util.Arrays;

/**
 * @program: Leetcode
 * @description:  https://leetcode-cn.com/problems/moving-stones-until-consecutive/submissions/
 * @author: STU756
 * @create: 2020-09-03 10:32
 */
public class Pro1033 {
    public int[] numMovesStones(int a, int b, int c) {
        int[] n = new int[3];
        n[0] = a;
        n[1] = b;
        n[2] = c;
        Arrays.sort(n);
        int ab = n[1] - n[0] - 1;
        int bc = n[2] - n[1] - 1;
        int mininum = 0;
        if(ab == 0 &&  bc == 0) {
            mininum = 0;
        }else if(ab == 0 || bc == 0) {
            mininum = 1;
        }else if(ab == 1 || bc == 1) {
            mininum = 1;
        }else {
            mininum = 2;
        }
        return new int[]{mininum,  ab+bc};
    }
}
